var network = require("../../utils/request.js")
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    ordersData:[],//接单方
    demandData:[],//需求方

    ordersEvaluatePT:0,
    ordersSuccessRate: 0,
    demandEvaluatePT: 0,
    demandSuccessRate: 0,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getDemandEvaluateMindInfo();
    this.getOrdersEvaluateMindInfo();
  },
  //需求方
  getDemandEvaluateMindInfo:function(){
    let consumerId = app.globalData.consumerid;
    var param = { consumerId: consumerId};
  
    var that = this;
    network.requestLoading('POST', app.globalData.requestUrl + 'getDemandEvaluateMindInfoAPI', param, '加载中', function (res) {
      if (res.result == "success") {
         that.setData({
           demandData:res.data,
           demandEvaluatePT: res.evaluatePT,
           demandSuccessRate: res.successRate,
         })
      } else {
        wx.showToast({
          title: res.messge,
          icon: 'none'
        })
      }

    })
  },
  //接单方
  getOrdersEvaluateMindInfo:function(){
    var that = this;
    let consumerId = app.globalData.consumerid
    var param = { consumerId: consumerId };
 
    network.requestLoading('POST', app.globalData.requestUrl + 'getOrdersEvaluateMindInfoAPI', param, '加载中', function (res) {
      if (res.result == "success") {
        that.setData({
          ordersData: res.data,
          ordersEvaluatePT: res.evaluatePT,
          ordersSuccessRate: res.successRate
        })
      } else {
        wx.showToast({
          title: res.messge,
          icon: 'none'
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  }
})